the output of the script to a temporary file.
Copy the Code code as follows:
*/5 * * * */usr/bin/curl-o temp.txt http://www.jb51.net/myscript.php
The following example uses the wget access URL to execute PHP scripts every 10 minutes. The-q option indicates quiet mode. "-O Temp.txt" indicates that the output is sent to a temporary file.
Copy the Code code as follows:
*/10 * * * */usr/bin/wget-q-o temp.txt http://www.jb51.net/myscript.php
The above describes how the
Linux crontab Command Format and example
Linux crontab Command Format and example
Run */5 * every five minutes ****
0 *** per hour ****
Execute 0 0 every day ***
Execute 0 0 every week ** 0
0 0 1 per month **
Execute 0 0 1 1 * eve
Crontab is a common timing function in linux. It can also be called the scheduled task function. Next I will introduce some formats and usage of crontab commands.
Crontab is a service that comes with a scheduled execution program in most Linux releases. You can use the
Crontab is a service that most Linux distributions bring with them a timed execution program. The CRONTAB-E command enables you to open a text editor to edit a timed task for the current user.
The specific format is as follows:
Name: crontab
Use Rights: All users
How to
a to the minute, and F2 is a-B to run from the first to the firstWhen F1 is */n, it is run every n minutes, F2 is */n for every n-hour interval, and the remainder of the analogyWhen F1 is a, B, C,... A, B, C,... Minutes to run, F2 A, B, C,... The time indicated that the first, B, c ... Hours to run, and the rest of the analogyThe user is also able to store all the settings in the file file, using crontab file to set the time schedule.Examples:#每天早上7点
of the hour, and the F2 is a-B indicating that it is executed from the first to the first, and the remainder of the analogyWhen F1 is */n, it is performed once every n minutes, and F2 is */n for every n-hour interval, with the remainder of the other analogyWhen F1 is a, B, C,... A, B, C,... Minutes to execute, F2 for a, B, C,... The time indicated that the first, B, c ... Hours to execute, and the rest of the analogyThe user can also store all the settings in the file file, using the
specified by the VISUAL or editor environment variable to edit the user's Crontab The file uses the same format as the /etc/crontab . When a change to crontab is saved, the crontab file is saved according to the user name and written to the file /var/spool/cron/username .T
the hour, and the F2 is a-B indicating that it is executed from the first to the first, and the remainder of the analogyWhen F1 is */n, it is performed once every n minutes, and F2 is */n for every n-hour interval, with the remainder of the other analogyWhen F1 is a, B, C,... A, B, C,... Minutes to execute, F2 for a, B, C,... The time indicated that the first, B, c ... Hours to execute, and the rest of the analogyThe user can also store all the settings in the file file, using the
Basic Format:* *** CommandHour, day, month, and week commands
The 1st column indicates minute 1 ~ 59. Each minute is represented by * or */1.The first column indicates the hour 1 ~ 23 (0 indicates 0 points)The 3rd column indicates the date 1 ~ 31The 4th column indicates the month 1 ~ 12The Identification Number of column 5th is from day of the week to day ~ 6 (0 indicates Sunday)6th columns of commands to run
Some examples of
From: http://blog.csdn.net/ethanzhao/article/details/4406017
Basic Format:* *** CommandHour, day, month, and week commands
The 1st column indicates minute 1 ~ 59. Each minute is represented by * or */1.The first column indicates the hour 1 ~ 23 (0 indicates 0 points)The 3rd column indicates the date 1 ~ 31The 4th column indicates the month 1 ~ 12The Identification Number of column 5th is from day of the week to day ~ 6 (0 indicates Sunday)6th colu
Basic Format:
* *** Command
Hour, day, month, and week commands
The 1st column indicates minute 1 ~ 59. Each minute is represented by * or */1.
The first column indicates the hour 1 ~ 23 (0 indicates 0 points)
The 3rd column indicates the date 1 ~ 31
The 4th column indicates the month 1 ~ 12
The Identification Number of column 5th is from day of the week to day ~ 6 (0 indicates Sunday)
6th columns of commands to run
Some examples of
Basic format:* * * * * commandTime-sharing Weekly commandThe 1th column represents minutes 1~59 per minute with * or */1The 2nd column represents the hour 1~23 (0 means 0 points)The 3rd column represents the date 1~31The 4th column represents the month 1~125th Column Identification Number Week 0~6 (0 = Sunday)6th List of commands to executeSome examples of crontab files:* * * * */usr/local/etc/rc.d/lighttpd
problem-free script on the command line;Solution: 1 , command use absolute path 2. Start your own definition of a dedicated PATH environment variable in the script Each job of the user cron consists of 2 parts Time minutes, hours, days , months , weeks . CommandBasic format:* * * * * commandTime-sharing Weekly commandThe 1th column represents minutes 1~59 per minute with * or */1The 2nd column represents the hour 1~23 (0 means 0 points)The 3rd c
Basic format:* * * * * commandTime-sharing Weekly commandThe 1th column represents minutes 1~59 per minute with * or */1The 2nd column represents the hour 1~23 (0 means 0 points)The 3rd column represents the date 1~31The 4th column represents the month 1~125th Column Identification Number Week 0~6 (0 = Sunday)6th List of commands to runSome examples of crontab files:* * * * */usr/local/etc/rc.d/lighttpd res
Basic format:* * * * * commandTime-sharing Weekly commandThe 1th column represents minutes 1~59 per minute with * or */1The 2nd column represents the hour 1~23 (0 means 0 points)The 3rd column represents the date 1~31The 4th column represents the month 1~125th Column Identification Number Week 0~6 (0 = Sunday)6th List of commands to runSome examples of crontab files:* * * * */usr/local/etc/rc.d/lighttpd res
Transfer from http://www.jb51.net/LINUXjishu/19905.htmlBasic format:* * * * * commandTime-sharing Weekly commandThe 1th column represents minutes 1~59 per minute with * or */1The 2nd column represents the hour 1~23 (0 means 0 points)The 3rd column represents the date 1~31The 4th column represents the month 1~125th Column Identification Number Week 0~6 (0 = Sunday)6th List of commands to runSome examples of crontab
Basic format:* * * * * commandTime-sharing Weekly commandThe 1th column represents minutes 1~59 per minute with * or */1The 2nd column represents the hour 1~23 (0 means 0 points)The 3rd column represents the date 1~31The 4th column represents the month 1~125th Column Identification Number Week 0~6 (0 = Sunday)6th List of commands to runSome examples of crontab files:* * * * */usr/local/etc/rc.d/lighttpd res
Basic format:* * * * * commandTime-sharing Weekly commandThe 1th column represents minutes 1~59 per minute with * or */1The 2nd column represents the hour 1~23 (0 means 0 points)The 3rd column represents the date 1~31The 4th column represents the month 1~125th Column Identification Number Week 0~6 (0 = Sunday)6th List of commands to runSome examples of crontab files:* * * * */usr/local/etc/rc.d/lighttpd res
Basic format:* * * * * commandTime-sharing Weekly commandThe 1th column represents minutes 1~59 per minute with * or */1The 2nd column represents the hour 1~23 (0 means 0 points)The 3rd column represents the date 1~31The 4th column represents the month 1~125th Column Identification Number Week 0~6 (0 = Sunday)6th List of commands to runSome examples of crontab files:* * * * */usr/local/etc/rc.d/lighttpd res
Basic format:* * * * * commandTime-sharing Weekly commandThe 1th column represents minutes 1~59 per minute with * or */1The 2nd column represents the hour 1~23 (0 means 0 points)The 3rd column represents the date 1~31The 4th column represents the month 1~125th Column Identification Number Week 0~6 (0 = Sunday)6th List of commands to executeSome examples of crontab files:* * * * */usr/local/etc/rc.d/lighttpd
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.